import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/menu',
    method: 'GET',
    params: query
  })
}

export function fetchMenu(query) {
	return request({
		url: '/menu/GetAllMenu',
		method: 'GET',
		params: query
	})
}

export function getMenu(id){
	return request({
		url: `/menu/${id}`,
		method: 'GET'
	})
}

export function saveMenu(data){
	return request({
		url: '/menu',
		method: 'POST',
		data
	})
}

export function deleteMenu(id){
	return request({
		url:`/menu/${id}`,
		method: 'DELETE'
	})
}

export function assignMenu(data){
	return request({
		url: `/auth/AssignMenu/${data.RoleId}`,
		method: 'PUT',
		data
	})
}

export function updateMenu(data){
	return request({
		url: `/menu/${data.Id}`,
		method: 'PUT',
		data
	})
}